home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / MPW Interfaces & Libraries / AIncludes / SCSIEqu.a < prev    next >
Encoding:
Text File  |  1992-01-29  |  11.9 KB  |  359 lines  |  [TEXT/MPS ]

  1. ; Version: 3.19
  2. ; Created: Friday, October 20, 1989 at 9:50:00 PM
  3. ;
  4. ; File: SCSIEqu.a
  5. ;
  6. ; Assembler Interface to the Macintosh Libraries
  7. ; Copyright Apple Computer, Inc. 1986-1991
  8. ; All Rights Reserved
  9. ;
  10. ; Equates for SCSI boot, mgr routines
  11. ; SCSI Traps
  12. ;________________________________________________________________________________
  13.  
  14.     IF &TYPE('__IncludingSCSIEqu__') = 'UNDEFINED' THEN
  15. __IncludingSCSIEqu__    SET    1
  16.  
  17.     IF &TYPE('__IncludingTraps__') = 'UNDEFINED' THEN
  18.     INCLUDE 'Traps.a'
  19.     ENDIF
  20.  
  21. ; misc SCSI driver equates
  22.  
  23. scMacID           EQU         $80                       ; SCSI ID for Macintosh Plus (bit 7)
  24. SCSIDrvrs         EQU         $B2E                      ; (word) bitmap for loaded SCSI drivers
  25.  
  26. ; SCSI error codes
  27.  
  28. scCommErr         EQU         2                         ; communications error (operation timeout)
  29. scArbNBErr        EQU         3                         ; arbitration timeout waiting for not BSY
  30. scBadparmsErr     EQU         4                         ; bad parameter or TIB opcode
  31. scPhaseErr        EQU         5                         ; SCSI bus not in correct phase for attempted operation
  32. scCompareErr      EQU         6                         ; data compare error
  33. scMgrBusyErr      EQU         7                         ; SCSI Manager busy with another operation
  34. ; when SCSIGet was called
  35.  
  36. scSequenceErr     EQU         8                         ; attempted operation is out of sequence;
  37. ; e.g., calling SCSISelect before doing
  38. ; SCSIGet. Incorrectly written drivers
  39. ; can cause this error.
  40.  
  41. scBusTOErr        EQU         9                         ; CPU bus timeout when attempting read or
  42. ; write in pseudo-DMA mode -- indicates
  43. ; that the data wasn't ready within the
  44. ; 'bus timeout' period. (Mac SE & Mac II only)
  45.  
  46. scComplPhaseErr   EQU         10                        ; SCSI bus wasn't in Status phase when
  47. ; SCSIComplete was called -- the SCSI
  48. ; Manager may have had to throw away data
  49. ; (or write 'filler' bytes) in order to
  50. ; reach the Status phase. Indicates that
  51. ; the driver didn't handle SCSI bus phase
  52. ; changes correctly.
  53.  
  54.  
  55. ; misc SCSI driver equates
  56.  
  57. scDefaultID       EQU         7                         ; default CPU SCSI id
  58.  
  59. ;---------------------------------------------------
  60. ;
  61. ; the information pertaining to the read/write
  62. ; command block interpreter.
  63. ;
  64. ; SCSI command block equates.
  65. ;
  66.  
  67. scOpcode          EQU         0                         ; offsets into command "line" for data xfer
  68. scParam1          EQU         2
  69. scParam2          EQU         6
  70. scSize            EQU         10                        ; size of a command line
  71.  
  72.  
  73. scInc             EQU         1                         ; xfer with address increment
  74. scNoInc           EQU         2                         ; xfer without address increment
  75. scAdd             EQU         3                         ; add count to address
  76. scMove            EQU         4                         ; MOVE data from addr1 to addr2
  77. scLoop            EQU         5                         ; decrement loop counter and branch
  78. scNop             EQU         6                         ; do very little
  79. scStop            EQU         7                         ; then stop doing even that
  80. scComp            EQU         8                         ; compare bytes with address increment
  81.  
  82. ;
  83. ; The layout of block 0 of a bootable SCSI device.
  84. ;
  85.  
  86. sbSigWord         EQU         $4552                     ; block 0 validator
  87. sbSig             EQU         0                         ; signature word
  88. sbBlkSize         EQU         2                         ; block size of device
  89. sbBlkCount        EQU         4                         ; # blocks on device
  90. sbDevType         EQU         8                         ; device type code
  91. sbDevID           EQU         10
  92. sbData            EQU         12                        ; start of data section
  93. sbDrvCount        EQU         16                        ; # drivers following
  94. sbDrvrs           EQU         18                        ; start of driver descriptors
  95.  
  96. ; Driver descriptors
  97.  
  98. ddBlock           EQU         0                         ; physical block of driver
  99. ddSize            EQU         4                         ; block count of driver
  100. ddType            EQU         6                         ; Processor type of driver
  101. ddLen             EQU         8
  102. sbMac             EQU         1                         ; Macintosh driver type
  103.  
  104. ;
  105. ; Partition Descriptors
  106. ;
  107. pdSigWord         EQU         $5453                     ; block 1 validator
  108. pmSig             EQU         0                         ; unique value for map entry blk
  109. pmSigPad          EQU         2                         ; currently unused
  110. pmMapBlkCnt       EQU         4                         ; # of blks in partition map
  111. pmPyPartStart     EQU         8                         ; first physical block of partition
  112. pmPartBlkCnt      EQU         12                        ; number of blocks in partition
  113. pmPartName        EQU         16                        ; ASCII partition name
  114. pmParType         EQU         48                        ; ASCII partition type
  115. pmLgDataStart     EQU         80                        ; log. # of partition's 1st data blk
  116. pmDataCnt         EQU         84                        ; # of blks in partition's data area
  117. pmPartStatus      EQU         88                        ; bit field for partition status
  118. pmLgBootStart     EQU         92                        ; logical blk of partition's boot code
  119. pmBootSize        EQU         96                        ; number of bytes in boot code
  120. pmBootAddr        EQU         100                       ; memory load address of boot code
  121. pmBootAddr2       EQU         104                       ; currently unused
  122. pmBootEntry       EQU         108                       ; entry point of boot code
  123. pmBootEntry2      EQU         112                       ; currently unused
  124. pmBootCksum       EQU         116                       ; checksum of boot code
  125. pmProcessor       EQU         120                       ; ASCII for the processor type
  126. pmPad             EQU         124                       ; 512 bytes long, currently unused
  127.  
  128.  
  129. hfsID             EQU         'TFS1'                    ; The HFS filesystem ID
  130.  
  131. ;Routine Selectors
  132.  
  133. scsiReset         EQU         0
  134. scsiGet           EQU         1
  135. scsiSelect        EQU         2
  136. scsiCmd           EQU         3
  137. scsiComplete      EQU         4
  138. scsiRead          EQU         5
  139. scsiWrite         EQU         6
  140. scsiInstall     EQU         7
  141. scsiRBlind        EQU         8
  142. scsiWBlind        EQU         9
  143. scsiStat          EQU         10
  144. scsiSelAtn        EQU         11
  145. scsiMsgIn         EQU         12
  146. scsiMsgOut        EQU         13
  147. numSelectors      EQU         14
  148.  
  149.  
  150.                   MACRO
  151.                   _SCSIReset
  152.                   MOVE        #scsiReset,-(sp)
  153.                   _SCSIDispatch
  154.                   ENDM
  155.  
  156.                   MACRO
  157.                   _SCSIGet
  158.                   MOVE        #scsiGet,-(sp)
  159.                   _SCSIDispatch
  160.                   ENDM
  161.  
  162.                   MACRO
  163.                   _SCSISelect
  164.                   MOVE        #scsiSelect,-(sp)
  165.                   _SCSIDispatch
  166.                   ENDM
  167.  
  168.                   MACRO
  169.                   _SCSICmd
  170.                   MOVE        #scsiCmd,-(sp)
  171.                   _SCSIDispatch
  172.                   ENDM
  173.  
  174.                   MACRO
  175.                   _SCSIComplete
  176.                   MOVE        #scsiComplete,-(sp)
  177.                   _SCSIDispatch
  178.                   ENDM
  179.  
  180.                   MACRO
  181.                   _SCSIRead
  182.                   MOVE        #scsiRead,-(sp)
  183.                   _SCSIDispatch
  184.                   ENDM
  185.  
  186.                   MACRO
  187.                   _SCSIWrite
  188.                   MOVE        #scsiWrite,-(sp)
  189.                   _SCSIDispatch
  190.                   ENDM
  191.  
  192.                   MACRO
  193.                   _SCSIInstall
  194.                   MOVE        #scsiInstall,-(sp)
  195.                   _SCSIDispatch
  196.                   ENDM
  197.  
  198.                   MACRO
  199.                   _SCSIRBlind
  200.                   MOVE        #scsiRBlind,-(sp)
  201.                   _SCSIDispatch
  202.                   ENDM
  203.  
  204.                   MACRO
  205.                   _SCSIWBlind
  206.                   MOVE        #scsiWBlind,-(sp)
  207.                   _SCSIDispatch
  208.                   ENDM
  209.  
  210.                   MACRO
  211.                   _SCSIStat
  212.                   MOVE        #scsiStat,-(sp)
  213.                   _SCSIDispatch
  214.                   ENDM
  215.  
  216.  
  217.                   MACRO
  218.                   _scsiSelAtn
  219.                   MOVE        #scsiSelAtn,-(sp)
  220.                   _SCSIDispatch
  221.                   ENDM
  222.  
  223.                   MACRO
  224.                   _SCSIMsgIn
  225.                   MOVE        #scsiMsgIn,-(sp)
  226.                   _SCSIDispatch
  227.                   ENDM
  228.  
  229.                   MACRO
  230.                   _SCSIMsgOut
  231.                   MOVE        #scsiMsgOut,-(sp)
  232.                   _SCSIDispatch
  233.                   ENDM
  234.  
  235. ;
  236. ;    New SCSI Manager
  237.  
  238. ;
  239. ;    SCSI request parameter block
  240. ;
  241. scsiPB            RECORD      0, INCREMENT
  242. scsiQLink         DS.L        1                         ; --- link to next request block                        
  243. scsiPrivate       DS.L        1                         ; --- SCSI Mgr private storage
  244. scsiVersion       DS.W        1                         ; --> version of the parameter block
  245. scsiBus           DS.W        1                         ; --> SCSI bus number
  246. scsiReqID         DS.B        1                         ; --> SCSI ID
  247. scsiReqLUN        DS.B        1                         ; --> logical unit number
  248. scsiResult        DS.W        1                         ; <-- return code from SCSI Manager
  249. scsiCompletion    DS.L        1                         ; --> address of completion routine
  250. scsiUsrData       DS.L        1                         ; --> pointer to user's storage
  251. scsiReqTO         DS.L        1                         ; --> in ms
  252. scsiUsrFlags      DS.W        1                         ; --> user's operation flag bits
  253. scsiSelTO         DS.W        1                         ; --> in ms
  254. scsiMgrFlags      DS.L        1                         ; --> SCSI operation flags
  255. scsiLinkCmd       DS.L        1                         ; --> ptr to next linked command
  256. scsiSnsBuf        DS.L        1                         ; --> sense buffer pointer
  257. scsiSnsLen        DS.B        1                         ; --> length of sense buffer ( at least 4 bytes )
  258. scsiSnsXfer       DS.B        1                         ; <-- actual sense bytes transferred
  259. scsiStatus        DS.B        1                         ; --> SCSI status byte
  260. scsiCmdLen        DS.B        1                         ; --> length of the command buffer
  261. scsiCmdBuf        DS.L        1                         ; --> command buffer pointer
  262. scsiDCInstr       DS.L        1                         ; --> ptr to array of data-chaining instructions
  263. scsiDataLen       DS.L        1                         ; --> requested data transfer length
  264. scsiDataXfer      DS.L        1                         ; <-- actual data bytes transferred
  265. scsiPBSize        EQU         *-scsiPB                  ; size of SCSI request parameter block
  266.                   ENDR
  267.  
  268. ;
  269. ;    flags
  270. ;
  271. ;    SCSI Mgr flags:
  272. ;
  273. scsiFParity       EQU         $00000001                 ; Enable parity checking
  274. scsiFNoDisc       EQU         $00000002                 ; Disconnection not allowed for this request
  275. scsiFWrite        EQU         $00000004                 ; output data to the SCSI bus
  276. scsiFFast         EQU         $00000008                 ; Transfer data in the "fast" mode
  277. scsiFPhysical     EQU         $00000010                 ; physical addresses are used (enables DMA)
  278. scsiFAsync        EQU         $00000020                 ; asynchronous request
  279. scsiFBusDevRst    EQU         $00000040                 ; attempt to send a Bus Device Reset message
  280. scsiFImmed        EQU         $00000080                 ; Immediate ("page fault") service requested
  281. ;    SCSI Mgr bits:
  282. scsiBParity       EQU         0                         ; enable parity checking
  283. scsiBNoDisc       EQU         1                         ; disconnection not allowed for this request
  284. scsiBWrite        EQU         2                         ; output data to the SCSI bus
  285. scsiBFast         EQU         3                         ; transfer data in the "fast" mode
  286. scsiBPhysical     EQU         4                         ; physical addresses are used (enables DMA)
  287. scsiBAsync        EQU         5                         ; asynchronous request
  288. scsiBBusDevRst    EQU         6                         ; attempt to send a Bus Device Reset message
  289. scsiBImmed        EQU         7                         ; Immediate ("page fault") service requested
  290.  
  291. ;
  292. ;    Data-chaining related equates
  293. ;                                
  294. dcLoop            EQU         -1                        ; loop opcode        (dcLoop,count,offset,store)
  295. dcStop            EQU         0                         ; stop opcode        (dcStop,-----,------,-----)
  296. ;                                ; move opcode        ( addr ,count,offset,store)
  297. dcInstr           RECORD      0, INCREMENT
  298. dcAddr            DS.L        1                         ; buffer start address    (0,-1,other)
  299. dcCount           DS.L        1                         ; generic count
  300. dcOffset          DS.L        1                         ; generic "offset"
  301. dcStore           DS.L        1                         ; used to create "Saved Data Pointer"
  302. dcSize            EQU         *-dcInstr                 ; size of one data-chaining instruction
  303.                   ENDR
  304.  
  305. ;
  306. ;    Status byte equates
  307. ;
  308. statusInitial     EQU         $FF                       ; initial "invalid" status byte value
  309. statusByteCode    EQU         $9E                       ; mask to clear vendor-unique bits in status byte
  310. statusRsrvBit     EQU         7                         ; reserved bit in status byte (must be zero for autosense)
  311. statusGood        EQU         $00                       ; status byte values with VU and reserved bits masked
  312. statusChkCond     EQU         $02
  313. statusCondMetGood EQU         $04
  314. statusBusy        EQU         $08
  315. statusIntGood     EQU         $10
  316. statusIntCMGood   EQU         $14
  317. statusRsrvConflict EQU        $18
  318.  
  319. ;
  320. ;    error codes on the original call
  321. ;
  322. scsiBadPBErr      EQU         -470                      ; invalid field(s) in the parameter block    
  323. ;
  324. ;    error codes in the "scsiResult" field
  325. ;
  326. scsiOverrunErr    EQU         -471                      ; attempted to transfer too many bytes    
  327. scsiTransferErr   EQU         -472                      ; write flag conflicts with data transfer phase 
  328. scsiBusTOErr      EQU         -473                      ; bus error during transfer 
  329. scsiSelectTOErr   EQU         -474                      ; scsiSelTO exceeded (selection failed) 
  330. scsiTimeOutErr    EQU         -475                      ; scsiReqTO exceeded
  331. scsiBusResetErr   EQU         -476                      ; the bus was reset, so your request was aborted
  332. scsiBadStatus     EQU         -477                      ; non-zero (not "Good") status returned 
  333. scsiNoStatusErr   EQU         -478                      ; device did not go through a status phase    
  334. scsiLinkFailErr   EQU         -479                      ; linked command never executed     
  335. scsiUnimpVctErr   EQU         -489                      ; unimplemented routine was called        
  336. ;
  337. ;    "in progress" codes in the "scsiResult" field
  338. ;
  339. scsiEnqueued      EQU         $0001                     ; enqueued, waiting to start
  340. scsiArbitrated    EQU         $0002                     ; arbitration in progress, or attempted
  341. scsiSelection     EQU         $0003                     ; selection in progress, or target selected
  342. scsiDisc          EQU         $0004                     ; disconnected
  343. scsiDataOut       EQU         $0010                     ; Data Out phase
  344. scsiDataIn        EQU         $0011                     ; Data In phase
  345. scsiCommand       EQU         $0012                     ; Command phase
  346. scsiStatus        EQU         $0013                     ; Status phase
  347. scsiIllegal1      EQU         $0014                     ; Unknown (illegal) phase
  348. scsiIllegal2      EQU         $0015                     ; Unknown (illegal) phase
  349. scsiMessageOut    EQU         $0016                     ; Message Out phase
  350. scsiMessageIn     EQU         $0017                     ; Message In phase
  351.  
  352. ;
  353. ;    SCSIBusInfo information selectors
  354. ;
  355. scsiIntfLvl       EQU         0                         ; SCSI Mgr interface level (1-n)
  356. scsiBusTO         EQU         1                         ; byte-to-byte time limit (in us, 0=no timeout)
  357. scsiBusDMA        EQU         2                         ; bus has a dedicated DMA channel (1=has DMA)
  358.  
  359.     ENDIF    ; ...already included